package com.ydw.getProperties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * test
 *
 * @author ydw
 * @create 2017-07-06 下午2:36
 **/
@Configuration
@PropertySource("classpath:/test.properties")
@Component
public class Test {
    @Value("${book.name}")
    private String bookName;

    @Value("#{systemProperties['os.name']}")
    private String osName;



    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Test.class);
        Test bean = context.getBean(Test.class);
        System.out.println(bean.bookName);
        System.out.println(bean.osName);
    }
}
